package org.sn.jdish.designmode.factory;

import org.sn.jdish.designmode.factory.impl.ManShirtProducer;

public class ShirtFactoryMain {

	public static void main(String[] args) {
		System.out.println("普通工厂模式");
		SimpleShirtFactory shirtFactory1 = new SimpleShirtFactory();
		ShirtProducer shirtProducer1 = shirtFactory1.produce("shirt");
		shirtProducer1.produceShirt();

		try {
			System.out.println("普通工厂模式（反射）");
			ReflectSimpleShirtFactory shirtFactory11 = new ReflectSimpleShirtFactory();
			ShirtProducer shirtProducer11 = shirtFactory11.produce(ManShirtProducer.class.getName());
			shirtProducer11.produceShirt();
		} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
			e.printStackTrace();
		}

		System.out.println("多工厂方法模式");
		MultiShirtFactory shirtFactory2 = new MultiShirtFactory();
		ShirtProducer shirtProducer2 = shirtFactory2.produceManShirt();
		shirtProducer2.produceShirt();

		System.out.println("静态工厂方法模式");
		ShirtProducer shirtProducer3 = StaticMultiShirtFactory.produceShirt();
		shirtProducer3.produceShirt();
	}

}
